<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8" isELIgnored="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title></title>
    <link rel="stylesheet" href="../css/pintuer.css">
    <link rel="stylesheet" href="../css/admin.css">
    <script src="../js/jquery.js"></script>
    <script src="../js/pintuer.js"></script>
</head>
<body>
<form method="post" action="DepartmentServlet" id="listform">
    <div class="panel admin-panel">
        <div class="panel-head"><strong class="icon-reorder"> 部门列表</strong> <a href="" style="float:right; display:none;">添加字段</a></div>
        <div class="padding border-bottom">
            <ul class="search" style="padding-left:10px;">
                <li> <a class="button border-main icon-plus-square-o" href="departmentAdd.jsp"> 添加部门</a> </li>
                <%--<li>
                    <div class="label">
                        <label>请选择搜索方式</label>
                    </div>
                    <select id="serachId" name="serachId" class="input" style="width:200px; line-height:17px;">
                        <option value="1">部门id</option>
                        <option value="2">部门名</option>
                    </select>
                </li>
                <li>
                    <input type="text" id="keyWord" placeholder="请输入搜索关键字" name="keywords" class="input" style="width:250px; line-height:17px;display:inline-block" />
                    <a href="javascript:changesearch()" class="button border-main icon-search"> 搜索</a></li>--%>
            </ul>
        </div>
        <table class="table table-hover text-center">
            <tr>
                <th width="100" style="text-align:left; padding-left:20px;">部门ID</th>
                <!-- <th width="10%">序号</th> -->
                <th>部门名</th>
                <th width="310">操作</th>
            </tr>
            <c:forEach items="${pb.list}" var="d" varStatus="status">



                <tr>
                    <td style="text-align:left; padding-left:20px;">
                            ${d.id}
                    </td>

                    <td>${d.dptName}</td>

                    <td>
                        <div class="button-group">
                            <a class="button border-main" href="DepartmentServlet?flag=3&id=${d.id}"><span class="icon-edit"></span> 修改</a> &nbsp;
                            <a class="button border-red" href="javascript:mydel('${d.id}')" ><span class="icon-trash-o"></span> 删除</a>
                        </div>
                    </td>
                </tr>


            </c:forEach>



            <tr>
                <td colspan="8"><div class="pagelist">
                    <a href="DepartmentServlet?flag=1&page=1">首页</a>
                    <a href="DepartmentServlet?flag=1&page=${pb.currentPage-1}">上一页</a>
                    <a href="DepartmentServlet?flag=1&page=${pb.currentPage+1}">下一页</a>
                    <a href="DepartmentServlet?flag=1&page=${pb.totalPage}">尾页</a> </div></td>
            </tr>
        </table>
    </div>
</form>
<script type="text/javascript">

    function mydel(teaId){
        //alert(teaId);
        if(confirm("您确定要删除吗？")){
            //alert(this);
            var str = "DepartmentServlet?flag=5&id=" + teaId;
            location.href= str;
        }
    }

    //搜索
    function changesearch(){
        var keyWord = $("#keyWord").val();
        var searchId = $("#serachId").val();
        location.href="DepartmentServlet?flag=5&id=" + searchId + "&keyWord=" + keyWord;
    }


</script>
</body>
</html>